<?php
/**
 * Created by PhpStorm.
 * User: chy
 * Date: 2017/10/12
 * Time: 下午3:55
 */
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="utf-8">
<head>
    <title>管理员列表-超级管理</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
    <link href="<?php echo base_url()?>css/general.css" rel="stylesheet" type="text/css" />

    <link href="<?php echo base_url()?>css/main.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="<?php echo base_url()?>js/jquery.js"></script>
    <script language="JavaScript"> var base_url = '<?php echo base_url()?>'; </script>
    <script language="javascript" type="text/javascript" src="<?php echo base_url()?>js/admin.js"></script>
    <script language="javascript" type="text/javascript" src="<?php echo base_url()?>js/bootstrap.min.js"></script>
    <link href="<?php echo base_url()?>css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="<?php echo base_url()?>css/bootstrap.min.css" rel="stylesheet" type="text/css" />

</head>
<script>
    function validateForm(){
        if (window.confirm("是否确认提交")) {
            return true;
        }
        return false;
    }
</script>
<body  class=" x-border-layout-ct" style="position: relative;" >
<div class="container">

    <div class="row">
        <div class="col-md-8">
            <h1>管理员</h1>
        </div>
    </div>
</div>
<div class="container navigation">
    <div class="row" style="background-color: #ff8000;font-size: 25px">
        <div class="col-md-1">
            <form action="<?php echo site_url('c_login/manage')?>" method="post" >
                <input id="inputSuccess" type="hidden" name="session_user_id" value="<?php echo $_SESSION['user_id']; ?>"/>
                <input id="inputSuccess" type="hidden" name="session_user_name" value="<?php echo $_SESSION['user_name']; ?>"/>
                <input id="inputSuccess" type="hidden" name="session_role_id" value="<?php echo $_SESSION['role_id']; ?>"/>
                <input id="inputSuccess" type="hidden" name="session_logged_in" value="<?php echo $_SESSION['logged_in']; ?>"/>
                <input style="width: 80px;height: 30px;background: #ff8000;color: white" class="btn btn-default"  type=submit name="session_add" value="首页"/>
            </form>
        </div>
        <div class="col-md-1">
            <form action="<?php echo site_url('c_user_manage/add_post')?>" method="post" >
                <input id="inputSuccess" type="hidden" name="session_user_id" value="<?php echo $_SESSION['user_id']; ?>"/>
                <input id="inputSuccess" type="hidden" name="session_user_name" value="<?php echo $_SESSION['user_name']; ?>"/>
                <input id="inputSuccess" type="hidden" name="session_role_id" value="<?php echo $_SESSION['role_id']; ?>"/>
                <input id="inputSuccess" type="hidden" name="session_logged_in" value="<?php echo $_SESSION['logged_in']; ?>"/>
                <input style="width: 80px;height: 30px;background: #ff8000;color: white" class="btn btn-default"  type=submit name="session_add" value="新增"/>
            </form>
        </div>
        <div class="col-md-8">
            <form action="<?php echo site_url('c_user_manage/update_password_post')?>" method="post" >
                <input id="inputSuccess" type="hidden" name="session_user_id" value="<?php echo $_SESSION['user_id']; ?>"/>
                <input id="inputSuccess" type="hidden" name="session_user_name" value="<?php echo $_SESSION['user_name']; ?>"/>
                <input id="inputSuccess" type="hidden" name="session_role_id" value="<?php echo $_SESSION['role_id']; ?>"/>
                <input id="inputSuccess" type="hidden" name="session_logged_in" value="<?php echo $_SESSION['logged_in']; ?>"/>
                <input style="width: 80px;height: 30px;background: #ff8000;color: white" class="btn btn-default"  type=submit name="session_update" value="修改密码"/>
            </form>
        </div>
        <div class="col-xs-2">
            <a style="color: white; font-size: 14px;">
                <?php echo $_SESSION['user_id']." ".$_SESSION['user_name'];?>
            </a>
        </div>
        <div class="col-xs-2">
            <a href='<?php echo site_url('c_login/logout');?>' style="color: white; font-size: 14px;">退出登录</a>
        </div>
    </div>
</div>
<div id="main-tabs" class="container navigation" style="text-align: center" align="center">
    <h4 style="text-align: center">管理员列表</h4>
    <!-- 菜单体 -->

                                <!-- 工具栏 -->

                                <!-- /工具栏 -->

<!-- 内容 -->
        <table cellpadding="3" cellspacing="0" id="listTable" class="table table-striped">
            <thead>
            <tr class="x-grid3-header">
                <th class="sort-numeric " >
                    <div class="x-grid3-hd-inner "style="text-align:center">ID</div></th>

                <th>
                    <div class="x-grid3-hd-inner"style="text-align:center">姓名</div></th>

                <th>
                    <div class="x-grid3-hd-inner"style="text-align:center">信息</div></th>

                <th>
                    <div class="x-grid3-hd-inner"style="text-align:center">角色</div></th>

                <th>
                    <div class="x-grid3-hd-inner"style="text-align:center">数据库</div></th>
                <th>
                    <div class="x-grid3-hd-inner"style="text-align:center">状态</div></th >

                <th>
                    <div class="x-grid3-hd-inner"style="text-align:center">最近登录时间</div></th >

                <th >
                    <div class="x-grid3-hd-inner"style="text-align:center">操作1</div></th >
                <th >
                    <div class="x-grid3-hd-inner"style="text-align:center">操作2</div></th >
            </tr>
            </thead>

            <tbody>
            <?php
            foreach ($user as $key=>$value)
            {
                ?>
                <tr class="x-grid3-row " >
                    <td><div class="x-grid3-cell-inner "style="text-align:center"><?php echo $user[$key]['user_id'] ?></div></td>
                    <td ><div class="x-grid3-cell-inner " style="text-align:center"><span onclick="listEdit(this, 'name', <?php echo $user[$key]['user_id'] ?>)"><?php echo $user[$key]['user_name']; ?></span></div></td>
                    <td ><div class="x-grid3-cell-inner "style="text-align:center"><?php echo $user[$key]['user_info'] ?></div></td>
                    <td ><div class="x-grid3-cell-inner "style="text-align:center"><?php  if($user[$key]['role_id']) echo "超级管理员"; else echo "普通管理"?></div></td>
                    <td ><div class="x-grid3-cell-inner "style="text-align:center"><?php  if($user[$key]['user_part']==0) echo '超级管理员'; else if($user[$key]['user_part']==1) echo '细菌'; else if($user[$key]['user_part']==2) echo '真菌'; else if($user[$key]['user_part']==3) echo '质粒'; else if($user[$key]['user_part']==4) echo '细胞';?></div></td>
                    <td ><div class="x-grid3-cell-inner "style="text-align:center"><?php  if($user[$key]['user_status']) echo "在职"; else echo "弃用"?></div></td>
                    <td ><div class="x-grid3-cell-inner "style="text-align:center"><?php echo $user[$key]['lastLoginTime'] ?></div></td>
                    <td ><div class="x-grid3-cell-inner "style="text-align:center">

                            <a>
                                <form action="<?php echo site_url('c_user_manage/update_post/'.$user[$key]['user_id'])?>" method="post" >
                                    <input id="inputSuccess" type="hidden" name="session_user_id" value="<?php echo $_SESSION['user_id']; ?>"/>
                                    <input id="inputSuccess" type="hidden" name="session_user_name" value="<?php echo $_SESSION['user_name']; ?>"/>
                                    <input id="inputSuccess" type="hidden" name="session_role_id" value="<?php echo $_SESSION['role_id']; ?>"/>
                                    <input id="inputSuccess" type="hidden" name="session_logged_in" value="<?php echo $_SESSION['logged_in']; ?>"/>
                                    <input style="width: 55px;height: 30px" class="btn" type=submit name="session_update" value="编辑"/>
                                </form>
                            </a>&nbsp;&nbsp;
                        </div></td>
                    <td ><div class="x-grid3-cell-inner "style="text-align:center">

                            <a>
                                <form onsubmit="return validateForm()" action="<?php echo site_url('c_user_manage/delete/'.$user[$key]['user_id'])?>" method="post" >
                                            <input id="inputSuccess" type="hidden" name="session_user_id" value="<?php echo $_SESSION['user_id']; ?>"/>
                                            <input id="inputSuccess" type="hidden" name="session_user_name" value="<?php echo $_SESSION['user_name']; ?>"/>
                                            <input id="inputSuccess" type="hidden" name="session_role_id" value="<?php echo $_SESSION['role_id']; ?>"/>
                                            <input id="inputSuccess" type="hidden" name="session_logged_in" value="<?php echo $_SESSION['logged_in']; ?>"/>
                                            <input style="width: 55px;height: 30px" class="btn"  type=submit name="session_dele" value="弃用"/>
                                </form>
                            </a>

                        </div></td>

                </tr>
                <?php
            }
            ?>
            </tbody></table>

    <!-- 分页显示 -->
    <?php
    //print_r($value);
    //print_r($temp);
    //print_r($options);
    //print_r($select);
    //print_r($segments);
    //echo "page:".$page;
    //print_r($books);
    //print $cat_selected;
    $data['total_pages'] = $total_pages;
    $data['page_first'] = $page_first;
    $data['page_prev'] = $page_prev;
    $data['total_pages'] = $total_pages;
    $data['page'] = $page;
    $data['page_next'] = $page_next;
    $data['page_last'] = $page_last;
    $data['show_start'] = $show_start;
    $data['show_end'] = $show_end;
    $data['total_rows'] = $total_rows;
    $this->load->view('pagination', $data);
    ?>
    <!-- /分页显示 --><!-- /内容 -->
    <div class="row" style="background-color: #ff8000;font-size: 25px">
        <div align="center" style=" text-align: center"><h6 align="center" style="text-align: center;color: #ff8000;">bacteria </h6></div>
    </div>
<!-- /菜单体 -->
</div>
</body>
</html>

